﻿using System;
using CTEM.Controllers.Global;

/// <summary>
/// Entity for table Debt
/// </summary>
///

namespace CTEM.Models
{
    public class DT_SupplierDTO
    {
        public long SupplierID { get; set; }
        public string SupplierName { get; set; }
        public string Address { get; set; }
        public string PhoneNumber { get; set; }
        public long TotalOwe { get; set; }
        public long ManagerID { get; set; }
        public bool IsActive { get; set; }
        public bool IsDelete { get; set; }
        public string Note { get; set; }
        public DateTime? CreatedDate { get; set; }
        public DateTime? LastUpdated { get; set; }
        public string CreatedBy { get; set; }
        public string UpdatedBy { get; set; }

        public HistoryLevel History { get; set; }

        public DT_SupplierDTO()
        {
            SupplierID = 0;
            SupplierName = Constants.EMPTY_TEXT;
            Address = Constants.EMPTY_TEXT;
            PhoneNumber = Constants.EMPTY_TEXT;
            TotalOwe = 0;
            ManagerID = 0;
            IsActive = true;
            IsDelete = false;
            Note = Constants.EMPTY_TEXT;
            CreatedBy = Global.CurrentUser.Username;
            CreatedDate = DateTime.Today;
            UpdatedBy = Global.CurrentUser.Username;
            LastUpdated = DateTime.Today;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(DT_SupplierDTO)) return false;
            return Equals((DT_SupplierDTO)obj);
        }


        public bool Equals(DT_SupplierDTO other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.SupplierID, SupplierID);
        }

        public static bool operator ==(DT_SupplierDTO left, DT_SupplierDTO right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(DT_SupplierDTO left, DT_SupplierDTO right)
        {
            return !Equals(left, right);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
